/*
    29. Write a program in C to read a file and remove the spaces between two words of its content.

    Expected Output :

    The content of the file is :                                           
    The quick brown fox jumps over the lazy dog                            
    After removing the spaces the content is :                             
    Thequickbrownfoxjumpsoverthelazydog
*/


#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>

char* removespace(char *str)
{
    char *p = malloc(strlen(str));
    char *sp = p;
    while(*str){
        if(!isspace(*str)){
            *p++ = *str;
        }
        str++;
    }
    *p = '\0';
    return sp;
}

int main(void)
{
    char *str ="The quick brown fox jumps over the lazy dog";
    printf("The content of the file is :\n%s \n", str);
    printf("The punctuation characters exists in the string is : \n%s", removespace(str));

    return 0;
}